using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Wiki_Ver - 维基控制 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IWikiVer<T> :ModelBase<WikiVer> where T : WikiVer, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.VerId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return VerId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.VerId=dy.VerId;
           this.FileId=dy.FileId;
           this.CheckUserId=dy.CheckUserId;
           this.CheckTime=dy.CheckTime;
           this.Detailed=dy.Detailed;
           this.IsCurrent=dy.IsCurrent;
           this.Status=dy.Status;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 版本ID
        /// </summary>
        private String _VerId = "";
      
        /// <summary>
        /// 版本ID
        /// </summary>
        public String VerId
        {
            get 
            {
              return   (this._VerId); 
            }

            set 
            {
                    _VerId= value;  
            }
        }
       
     
         /// <summary>
        /// 文件ID
        /// </summary>
        private String _FileId = "";
      
        /// <summary>
        /// 文件ID
        /// </summary>
        public String FileId
        {
            get 
            {
              return   (this._FileId); 
            }

            set 
            {
                    _FileId= value;  
            }
        }
       
     
         /// <summary>
        /// 签入用户ID
        /// </summary>
        private String _CheckUserId = "";
      
        /// <summary>
        /// 签入用户ID
        /// </summary>
        public String CheckUserId
        {
            get 
            {
              return   (this._CheckUserId); 
            }

            set 
            {
                    _CheckUserId= value;  
            }
        }
       
     
         /// <summary>
        /// 签入时间
        /// </summary>
        private DateTime _CheckTime =DateTime.MinValue;
      
        /// <summary>
        /// 签入时间
        /// </summary>
        public DateTime CheckTime
        {
            get 
            {
              return   (this._CheckTime); 
            }

            set 
            {
                    _CheckTime= value;  
            }
        }
       
     
         /// <summary>
        /// 说明
        /// </summary>
        private String _Detailed = "";
      
        /// <summary>
        /// 说明
        /// </summary>
        public String Detailed
        {
            get 
            {
              return   (this._Detailed); 
            }

            set 
            {
                    _Detailed= value;  
            }
        }
       
     
         /// <summary>
        /// 是否当前版本
        /// </summary>
        private int _IsCurrent =-1;
      
        /// <summary>
        /// 是否当前版本
        /// </summary>
        public yq.Enums.BooleanType IsCurrent
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsCurrent; 
            }

            set 
            {
                    _IsCurrent= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 状态
        /// </summary>
        private int _Status =-1;
      
        /// <summary>
        /// 状态
        /// </summary>
        public yq.Enums.WikiVer.Status Status
        {
            get 
            {
              return   (yq.Enums.WikiVer.Status)this._Status;  
            }

            set 
            {
                    _Status= value.GetHashCode(); 
            }
        }
       
     
       
       

      #endregion 定义属性 

          protected internal override void SetValue(WikiVer info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["VerId"]!= DBNull.Value)
                  {
                  info.VerId=row["VerId"].ToString();
                 }
                 
                  
                  if(row["FileId"]!= DBNull.Value)
                  {
                  info.FileId=row["FileId"].ToString();
                 }
                 
                  
                  if(row["CheckUserId"]!= DBNull.Value)
                  {
                  info.CheckUserId=row["CheckUserId"].ToString();
                 }
                 
                  
                  if(row["CheckTime"]!= DBNull.Value)
                  {
                  info.CheckTime=Convert.ToDateTime(row["CheckTime"]);
                 }
                 
                  
                  if(row["Detailed"]!= DBNull.Value)
                  {
                  info.Detailed=row["Detailed"].ToString();
                 }
                 
                  
                  if(row["IsCurrent"]!= DBNull.Value)
                  {
                  info.IsCurrent= (yq.Enums.BooleanType)(row["IsCurrent"]) ;
                 }
                 
                  
                  if(row["Status"]!= DBNull.Value)
                  {
                  info.Status=  (yq.Enums.WikiVer.Status)(row["Status"]) ;
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, WikiVer info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@VerId", DbType.String,ParameterTool.GetObj( info._VerId )); 
            
             
                cn.AddInParameter(comm, "@FileId", DbType.String,ParameterTool.GetObj( info._FileId )); 
            
             
                cn.AddInParameter(comm, "@CheckUserId", DbType.String,ParameterTool.GetObj( info._CheckUserId )); 
            
             
                cn.AddInParameter(comm, "@CheckTime", DbType.DateTime,ParameterTool.GetObj( info._CheckTime )); 
            
             
                cn.AddInParameter(comm, "@Detailed", DbType.String,ParameterTool.GetObj( info._Detailed )); 
            
             
                cn.AddInParameter(comm, "@IsCurrent", DbType.Int32,ParameterTool.GetObj( info._IsCurrent )); 
            
             
                cn.AddInParameter(comm, "@Status", DbType.Int32,ParameterTool.GetObj( info._Status )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 